// File: useCascaderOptions.ts
import { ref } from "vue";

export const useCascaderOptions = () => {
  const fileDir = ref('') //相对文件路径
  // 日期选择器
  const dataValue = ref('')
  const shortcuts = [{text: '今天',value: new Date()}]
  const value = ref(['info']);
  const options = [
    {
      value: 'info',
      label: '选择产线/工位',
      disabled: true,
    },
    {
      value: 'XYF1',
      label: 'XYF1',
      children: [
        {
          value: 'XYF01',
          label: 'XYF01',
        },
      ],
    },
    {
      value: 'XYF2',
      label: 'XYF2',
      children: [
        {
          value: 'XYF02',
          label: 'XYF02',
        },
      ],
    },
    {
      value: 'XYF3',
      label: 'XYF3',
      children: [
        {
          value: 'XYF03',
          label: 'XYF03',
        },
      ],
    },
    {
      value: 'XYF4',
      label: 'XYF4',
      children: [
        {
          value: 'XYF04',
          label: 'XYF04',
        },
      ],
    },
    {
      value: 'XYF5',
      label: 'XYF5',
      children: [
        {
          value: 'XYF05',
          label: 'XYF05',
        },
      ],
    },
    {
      value: 'ZYF1',
      label: 'ZYF加压1',
      children: [
        {
          value: 'ZYF01',
          label: 'ZYF加压01',
        },
      ],
    },
    {
      value: 'ZYF2',
      label: 'ZYF加压2',
      children: [
        {
          value: 'ZYF02',
          label: 'ZYF加压02',
        },
      ],
    },
    {
      value: 'ZYF3',
      label: 'ZYF加压3',
      children: [
        {
          value: 'ZYF03',
          label: 'ZYF加压03',
        },
      ],
    },
    {
      value: 'ZYF4',
      label: 'ZYF加压4',
      children: [
        {
          value: 'ZYF04',
          label: 'ZYF加压04',
        },
      ],
    },
    {
      value: 'ZYF5',
      label: 'ZYF加压5',
      children: [
        {
          value: 'ZYF05',
          label: 'ZYF加压05',
        },
      ],
    },
  ];
  const queryData = () =>{
    if (value.value[0] == 'info'){
      console.log('请选择产线/工位')
      return
    }
    if (dataValue.value == '' || dataValue.value == null){
      console.log('请选择日期')
      return
    }
    console.log('查询成功')
    console.log(value.value)
    console.log(dataValue.value)
    fileDir.value = dataValue.value + '/' + value.value[0] + '/' + value.value[1]
    
  }
  return {
    dataValue,
    shortcuts,
    value,
    options,
    fileDir,
    queryData
  };
};
